#include <stdio.h>
#include <signal.h>
#include "sig.h"
#include "eloop.h"

void handle_signal(int sig)
{
	switch (sig) {
	case SIGINT:
	case SIGTERM:
		printf("\nsignal: %d catched\n", sig);
		eloop_break();
		break;
	default:
		printf("signal:%d not handled\n", sig);
	}
}

void register_signal_terminate(void)
{
	signal(SIGINT, handle_signal);	
	signal(SIGTERM, handle_signal);	
}
